import socket

# udp 服务端

socket_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
socket_server.bind(("127.0.0.1", 8888))

str1, addr = socket_server.recvfrom(1024)
print("收到客户端的信息:", str1.decode("utf-8"), addr)

response = input("请输入回复客户端的内容:")
socket_server.sendto(response.encode("utf-8"), addr)

socket_server.close()
